﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using DataAccessClasses;

namespace BUSINESS_OBJECT
{
    class APPOINTEMENT
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _ID = -99;
        private long _CID = -99;
        private string _COMPANY_NAME = "";
        private string _COMPANY_PERSON_NAME = "";
        private string _COMPANY_ADDRESS = "";
        private long _PHONE_NO = -99;
        private string _REASON = "";
        private string _DATE = "1/1/1800";
        private bool _ISDELETED = false;

        public bool ISDELETED
        {
            get
            {
                return _ISDELETED;
            }
            set
            {
                _ISDELETED = value;
            }
        }
        public long ID
        {
            get
            {
                return _ID;
            }
            set
            {
                _ID = value;
            }
        }
        public long CID
        {
            get
            {
                return _CID;
            }
            set
            {
                _CID = value;
            }
        }

        public string COMPANY_NAME
        {
            get
            {
                return _COMPANY_NAME;
            }
            set
            {
                _COMPANY_NAME = value;
            }
        }
        public string COMPANY_PERSON_NAME
        {
            get
            {
                return _COMPANY_PERSON_NAME;
            }
            set
            {
                _COMPANY_PERSON_NAME = value;
            }
        }
        public string COMPANY_ADDRESS
        {
            get
            {
                return _COMPANY_ADDRESS;
            }
            set
            {
                _COMPANY_ADDRESS = value;
            }
        }
        public long PHONE_NO
        {
            get
            {
                return _PHONE_NO;
            }
            set
            {
                _PHONE_NO = value;
            }
        }
        public string REASON
        {
            get
            {
                return _REASON;
            }
            set
            {
                _REASON = value;
            }
        }
        public string DATE
        {
            get
            {
                return _DATE;
            }
            set
            {
                _DATE = value;
            }
        }

        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@ID", ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@CID", CID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@COMPANY_NAME", COMPANY_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@COMPANY_PERSON_NAME", COMPANY_PERSON_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@COMPANY_ADDRESS", COMPANY_ADDRESS, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@PHONE_NO", PHONE_NO, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@REASON", REASON, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@DATE", DATE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8};
                return DAC.Save("APPOINTEMENT_SAVE", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long ID, long CID, string COMPANY_NAME, string COMPANY_PERSON_NAME, string COMPANY_ADDRESS, long PHONE_NO, string REASON, string DATE, bool ISDELETED, string PARAANDOR)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@ID", ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@CID", CID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@COMPANY_NAME", COMPANY_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@COMPANY_PERSON_NAME", COMPANY_PERSON_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@COMPANY_ADDRESS", COMPANY_ADDRESS, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@PHONE_NO", PHONE_NO, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@REASON", REASON, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@DATE", DATE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@PARAANDOR", PARAANDOR, DbType.AnsiString, ParameterDirection.Input);


                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9};
                DataTable dt1 = DAC.Select("APPOINTEMENT_GET", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}
